﻿using Microsoft.AspNetCore.Http;
using System;

namespace WebWap.Handler
{
    /// <summary>
    /// 页面业务操作
    /// </summary>
    public sealed class BizPage
    {
        /// <summary>
        /// 检查是否是Ajax请求
        /// </summary>
        public static bool IsAjaxRequest(HttpRequest request)
        {
            if (request == null)
                throw new ArgumentNullException("request");

            if (request.Headers != null)
                return request.Headers["X-Requested-With"] == "XMLHttpRequest";

            return false;
        }
    }
}
